//
//  JZCallPhone.swift
//
//
//  Created by S JZ on 2024/2/1.
//


import UIKit
import Foundation

public class JZCallPhone: NSObject {
    
    /// 封装打电话功能
    /// - Parameter phoneNum: 电话号码字符串
    @objc public static func callPhone(_ phoneNum: String) {
        var phone = "telprompt://" + phoneNum
        phone = phone.replacingOccurrences(of: " ", with: "")
        if let url = URL(string: phone), UIApplication.shared.canOpenURL(url) {
            if #available(iOS 10.0, *) {
                UIApplication.shared.open(url, options: [UIApplication.OpenExternalURLOptionsKey.universalLinksOnly : false]) { result in }
            }
        }
    }
}

